<script setup lang="ts">
  const {locale, locales, setLocale} = useI18n()
  const router = useRouter()

  const select_ref = ref(locale.value)
  const onChange=(data: string)=>
  {
    setLocale(data).then(()=>{
      router.go(0)
    })
  }
</script>

<template>
  <a-select v-model:value="select_ref" style="width: 120px" @change="onChange" >
    <a-select-option v-for="item in locales" :key="item" :value="item">
      {{item}}
    </a-select-option>
  </a-select>
</template>

<style scoped>

</style>